import { defineStore } from "pinia";
import microApp from "@micro-zoe/micro-app";

// 初始化全局数据
export const useStore = defineStore('store', {
  state: () => {
    return {
      curMenuKey: 'sub1',
      curUrl: 'http://0.0.0.0:1081'
    }
  },
  actions: {
    setCurMenu(curMenuObj) {
      this.curMenuKey = curMenuObj.name
      this.curUrl = curMenuObj.url
      microApp.setGlobalData({
        curMenuKey: curMenuObj.name,
        curUrl: curMenuObj.url,
      })
    }
  }
})